﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using MarsExplorerWebSite.Model;

namespace MarsExplorerWebSite.Functions
{
    public class removeTeam : FunctionBase
    {
        private MarsExplorerEntities dbContext;

        public removeTeam(HttpContext context)
            : base(context)
        {
            InitializeProperties();
        }

        public override string Execute()
        {
            Team deleteTeam = (from x in dbContext.Teams where x.TeamID == 1 select x).FirstOrDefault();
            dbContext.Teams.DeleteObject(deleteTeam);
            dbContext.SaveChanges();
            return "OK";
        }

        public override void InitializeProperties()
        {
            try
            {
                dbContext = new MarsExplorerEntities();
            }
            catch (Exception e)
            {
                string message = "";
#if DEBUG
                message += " : " + e.ToString();

#endif

               
            }
        }
    }
}